package uaiContacts.model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Droog
 */
@Entity
@Table(name = "tb_forma_pagamento", catalog = "sistema_ipi", schema = "public")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FormaPagamento.findAll", query = "SELECT f FROM FormaPagamento f"),
    @NamedQuery(name = "FormaPagamento.findByIdFormapagamento", query = "SELECT f FROM FormaPagamento f WHERE f.idFormapagamento = :idFormapagamento"),
    @NamedQuery(name = "FormaPagamento.findByDscFormapagamento", query = "SELECT f FROM FormaPagamento f WHERE f.dscFormapagamento = :dscFormapagamento")})
public class FormaPagamento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_formapagamento", nullable = false)
    private Integer idFormapagamento;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 40)
    @Column(name = "dsc_formapagamento", nullable = false, length = 40)
    private String dscFormapagamento;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idFormapagamento")
    private List<LancamentoFincanc> lancamentoFincancList;

    public FormaPagamento() {
    }

    public FormaPagamento(Integer idFormapagamento) {
        this.idFormapagamento = idFormapagamento;
    }

    public FormaPagamento(Integer idFormapagamento, String dscFormapagamento) {
        this.idFormapagamento = idFormapagamento;
        this.dscFormapagamento = dscFormapagamento;
    }

    public Integer getIdFormapagamento() {
        return idFormapagamento;
    }

    public void setIdFormapagamento(Integer idFormapagamento) {
        this.idFormapagamento = idFormapagamento;
    }

    public String getDscFormapagamento() {
        return dscFormapagamento;
    }

    public void setDscFormapagamento(String dscFormapagamento) {
        this.dscFormapagamento = dscFormapagamento;
    }

    @XmlTransient
    public List<LancamentoFincanc> getLancamentoFincancList() {
        return lancamentoFincancList;
    }

    public void setLancamentoFincancList(List<LancamentoFincanc> lancamentoFincancList) {
        this.lancamentoFincancList = lancamentoFincancList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFormapagamento != null ? idFormapagamento.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FormaPagamento)) {
            return false;
        }
        FormaPagamento other = (FormaPagamento) object;
        if ((this.idFormapagamento == null && other.idFormapagamento != null) || (this.idFormapagamento != null && !this.idFormapagamento.equals(other.idFormapagamento))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.FormaPagamento[ idFormapagamento=" + idFormapagamento + " ]";
    }
    
}